shared float4x4 matViewProjection:VIEW_PROJECTION;
shared float4x4 matWorld:WORLD;
shared float4x4 matView:VIEW;
shared float4     diffuseColor:DIFFUSE_COLOR;
texture diffuseMap:DIFFUSE_MAP;

int g_nDivision;
sampler diffuseMapSampler = 
sampler_state
{
    Texture     = <diffuseMap>;
    MipFilter  = LINEAR;
    MinFilter  = LINEAR;
    MagFilter = LINEAR;
};
struct VS_INPUT
{
    float4 position : POSITION0; 
    float3 normal   : NORMAL;
    float4 color 		: COLOR;
    float2 texcoord : TEXCOORD0;
};
struct VS_OUTPUT
{
    float4 position : POSITION0;
    float3 normal   : TEXCOORD0;
    float2 texcoord : TEXCOORD1;
    float   height : TEXCOORD2;
    float4 color    : COLOR;
};
VS_OUTPUT vs_main(VS_INPUT _input)
{
  VS_OUTPUT _out;
  float4x4 mat00 = mul(matViewProjection ,matView );
  _out.position = mul(_input.position,matView );
  _out.position = mul(_out.position,matViewProjection );
  _out.normal   = mul(_input.normal,matWorld );
  _out.height     = _input.position.x;
  _out.texcoord	= _input.texcoord;
  _out.color    = _input.color;
  return _out;
}

struct PS_INPUT
{
	float3  normal:	 TEXCOORD0;
  	float2  texcoord:TEXCOORD1;
    float   height : TEXCOORD2;
  	float4  color:	 COLOR;
};
float4 ps_main(PS_INPUT _input):COLOR0
{
	float4	xxx;
	xxx= tex2D(diffuseMapSampler,_input.texcoord);
	
	if( _input.height < g_nDivision )
		///xxx	=	float4(1.0f,1.0f,1.0f,0.0f);
		clip(-1.0f);
	if( _input.height > g_nDivision && _input.height < g_nDivision + 2 )
		xxx	=	float4(0.0f,0.0f,0.0f,1.0f);
	if( _input.height > g_nDivision + 2  )
		///xxx	=	float4(1.0f,1.0f,1.0f,0.0f);
	    clip(-1.0f);
	return xxx;
//	return tex2D(diffuseMapSampler,_input.texcoord);//*diffuseColor;
}

technique vs_2_0_ps_2_0
{
    pass P0
    {
    	CullMode	=	None;
        // vertex shader
        VertexShader = compile vs_3_0 vs_main();
        // pixel shader
			PixelShader  = compile ps_3_0 ps_main();
    }
}
 